﻿using DataLogical.TableClass;
using Biz.Utility;

namespace Biz.Treat
{
    public class GolfMatch : TreatContent
    {
        private decimal playFee = 0;

        public decimal PlayFee
        {
            get { return playFee; }
            set { playFee = value; }
        }
        private decimal membershipFee = 0;

        public decimal MembershipFee
        {
            get { return membershipFee; }
            set { membershipFee = value; }
        }
        private tblTreatGolfMatch content = new tblTreatGolfMatch();

        public override void save()
        {
            Calculate();
            content.ActualFee = ActualFee;
            content.AverageAmount = AverageAmount;
            content.NumberOfUs = NumberOfUs;
            content.NumOfPerson = NumOfPerson;
            content.OurEmployee = OurEmployee;
            content.TotalAmount = TotalAmount;
            content.PlayFee = PlayFee;
            content.MembershipFee = MembershipFee;
            if (Id == Define.NEW)
            {
                Id = content.Insert(content);
            }
            else
            {
                content.Update(content);
            }
        }

        public override void load(int _id)
        {
            content = new tblTreatGolfMatch(_id);
            Id = _id;
            ActualFee = content.ActualFee;
            AverageAmount = content.AverageAmount;
            NumberOfUs = content.NumberOfUs;
            NumOfPerson = content.NumOfPerson;
            OurEmployee = content.OurEmployee;
            TotalAmount = content.TotalAmount;
            PlayFee = content.PlayFee;
            MembershipFee = content.MembershipFee;
        }

        public override decimal CalculateAverageAmount()
        {
            return PlayFee + MembershipFee;
        }

        public override int CalculateNumOfPerson()
        {
            return NumberOfUs;
        }

        public override string PRODUCT_NAME
        {
            get { return TreatType.GolfMatch.ToString(); }
        }
    }
}
